<?php
class Vs_Question_Collection
	extends Vs_Collection
{
    public function setCategory($categories)
	{
    	foreach ( $this as $question){
    		$question->setCategory(
    			$categories->offsetGet( $question->categoryId )
    		);
    	}
	}
	
	public function setCity($cities)
	{
		foreach ( $this as $question){
			
			if( $question->cityId == null){
				continue;
			}
			
			$question->setCity(
				$cities->offsetGet( $question->cityId )
			);
		}
	}
	
	public function setReasonFamily($reasonFamilies)
	{
		foreach ( $this as $question){
			$question->setReasonFamily(
				$reasonFamilies->offsetGet( $question->reasonFamilyId )
			);
		}
	}
	
	public function setAnswers($answers)
	{
		foreach ( $this as $question){
			$question->setAnswers(
				$answers->getByKey( 'questionId', $question->getId() )
			);
		}
	}
	
}
